package org.example.other;

import java.util.HashMap;
import java.util.Map;

public class FieldData {
    private String fieldId;
    private Map<String, Double> sensorReadings = new HashMap<>();

    public FieldData(String fieldId) {
        this.fieldId = fieldId;
    }

    public void addReading(String sensorType, double value) {
        sensorReadings.put(sensorType, value);
    }

    public double getReading(String sensorType) {
        return sensorReadings.getOrDefault(sensorType, 0.0);
    }

    public String toString() {
        return "农田[" + fieldId + "]数据: " + sensorReadings;
    }
}